﻿using System;
using System.Windows;
using System.Windows.Controls;

using Perseus;
using Perseus.Data;

using Hetymine.Executioner.Data;

namespace Hetymine.Executioner.Plugins.Triggers.Speech {        
    /// <summary>
    /// Interaction logic for SpeechConfigurator.xaml
    /// </summary>
    public partial class SpeechConfigurator : UserControl, IConfigurator<IniFile> {
        private IniFile _Config;
        private bool _IsApply = true;  

        public SpeechConfigurator() {
            InitializeComponent();
            
            // Call String
            this.cCallString.TextChanged += new TextChangedEventHandler(CallString_TextChanged);
        }

        private void CallString_TextChanged(object sender, TextChangedEventArgs e) {
            if (!this._IsApply) { return; }

            this._Config.SetString("Speech", "Call String", this.cCallString.Text);
        }

        #region IConfigurator<IniFile>
        public void InitializeConfig(IniFile config) {
            this._Config = config;

            this._IsApply = false;

            // Command
            this.cCallString.Text = this._Config.GetString("Speech", "Call String", "speech");
          

            this._IsApply = true;
        }
        public UserControl ConfigPanel { get { return this; } }
        #endregion
    }
}
